package lambda_expression;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * lambda表达式类型检查
 */
public class App3 {

    /**
     * @author : albin
     * @date : 2019/12/8 0:01
     */
    public static void test(MyInterface<String, List> inter){
        List<String> list = inter.strategy("hello", new ArrayList());
        System.out.println(list);
    }


    public static void main(String[] args) {
        test(new MyInterface<String, List>() {
            @Override
            public List strategy(String s, List list) {
                list.add(s);
                return list;
            }
        });


        test((s, l) -> {
            l.add(s);
            return l;
        });
    }

}

@FunctionalInterface
interface MyInterface<T,R>{
    R strategy(T t, R r);
}